﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufBase.h"
#include "GnufPallet.h"
#include "GnufDynamicPanelBase.h"

namespace gnuf {
    class Block;
    class ButtonEx;
    enum class EButtonDisplayStyle;
    class GNUF_BASE_EXPORT BlockRenovator final: public BlockBuilderBase
    {
    public:
        BlockRenovator(Block *, IToolbarWatcher *, EButtonDisplayStyle style);
        virtual ~BlockRenovator();
    };
    
    class GNUF_BASE_EXPORT AssistantPanel final
        : public DynamicPanelBase  
    {
        DEFINE_CAST_DERIVED(AssistantPanel,DynamicPanelBase)
    public:
        AssistantPanel();
        virtual ~AssistantPanel();
        static AssistantPanel * get();
        gcmp::OwnerPtr< BlockRenovator > renovateBlockAt(int);
    protected:
        // Inherits from ArrangementAreaContent...
        virtual QWidget * qtWidget() override;
        virtual void onPostOpacityChanged() override;
        virtual void onPostConnectedWithArrangementArea() override;
        virtual void onPreDisconnectedFromArrangementArea() override;
        virtual void onPostAbilityChanged() override;
        virtual void onEvent(ArrangementAreaEvent*) override;

        // Inherits from Component...
        virtual void initialize(Toolbar *) override;
        virtual gcmp::OwnerPtr<QtToolbar> createQtToolBar(Toolbar*) override;

        // Inherits from IItemEventHandler...
        virtual bool onPreClicked(Item *) override;
        virtual void onHeightChanged(Toolbar* toolbar, int height) override;

    private:
        Block * blockAt(int);
    };
}
